package com.njust.controller;

import com.njust.common.ServerRespone;
import com.njust.form.ParamForm;
import com.njust.service.SysParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/settings")
@Api("参数设置")
public class SystemParamController {
    @Autowired
    private SysParamService sysParamService;

    /**
     * 保存阈值
     * @param paramForm
     * @return
     */
    @PostMapping("/trainparam/save")
    @ApiOperation(value="阈值设置")
    public ServerRespone paramSave(@RequestBody ParamForm paramForm){
        ServerRespone serverRespone = sysParamService.paramSave(paramForm);
        return serverRespone;
    }

    /**
     * 查询阈值状态
     * @return
     */
    @GetMapping("/trainparam")
    @ApiOperation(value="阈值查看",notes = "回显")
    public ServerRespone selectLastId(){
        ServerRespone serverRespone = sysParamService.showParam();
        return serverRespone;
    }
}
